package com.example.yuejian21.nongfusanquan.yuejian21.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.View;
import android.view.ViewDebug;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.yuejian21.nongfusanquan.yuejian21.R;
import com.example.yuejian21.nongfusanquan.yuejian21.fragment.ActivityFragment;
import com.squareup.picasso.Picasso;

/**
 * Created by Nongfusanquan on 2017-10-12.
 */

public class GiftdetailActivity extends AppCompatActivity {
    private TextView giftdetail_name,giftdetail_value,giftdetail_info;
    private Button giftdetail_return;
    private ImageView giftdetail_pic;


    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_giftdetail);
        initViews();
        initEvent();
        getData();

    }
    private void initViews(){
        giftdetail_return = (Button)findViewById(R.id.return_giftdetail);
        giftdetail_pic = (ImageView)findViewById(R.id.giftdetail_pic);
        giftdetail_name = (TextView)findViewById(R.id.giftdetail_name);
        giftdetail_value = (TextView)findViewById(R.id.giftdetail_value);
        giftdetail_info = (TextView)findViewById(R.id.giftdetail_info);

    }
    private void initEvent(){
        giftdetail_return.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
    private void getData() {
        Bundle bundle = this.getIntent().getExtras();
        String aname = bundle.getString("g_name");
        String values = bundle.getString("g_values");
        String aintro =bundle.getString("g_info");
        String apicture = "http://10.0.2.2/yuejian14/Public/Admin/giftpic/"+bundle.getString("g_pic");

        giftdetail_name.setText(aname);
        giftdetail_value.setText(values);
        giftdetail_info.setText(aintro);
        Picasso.with(this).load(apicture).into(giftdetail_pic);
    }

}
